import request from '@/utils/request.js'
/**
 * 获取所有部门
 */
 export const deptList = () => {
  return request({
    url: '/sys/dept'
  })
}
/**
 * 获取所有部门树
 */
export const deptTreeList = () => {
  return request({
    url: '/sys/dept/tree'
  })
}
/**
 * 分页查询机构列表
 * @returns
 */
export const dept = (params, page, size) => {
  return request({
    url: `/sys/dept/search/${page}/${size}`,
    method: 'POST',
    data: params
  })
}
/**
 * 编辑机构
 * @returns
 */
export const editDept = (data) => {
  return request({
    url: '/sys/dept',
    method: 'POST',
    data: data
  })
}
/**
 * 根据id删除机构
 * @returns
 */
export const delDept = (id) => {
  return request({
    url: `/sys/dept/${id}`,
    method: 'DELETE'
  })
}
/**
 * 保存部门
 * @returns
 */
export const saveDept = (data) => {
  return request({
    url: '/sys/dept',
    method: 'POST',
    data: data
  })
}
